<template>
  <div class="home">
    <Swiper :lunbolist="lunbolist"></Swiper>
    <van-grid
      :column-num="3"
      icon-size="60px"
    >
      <van-grid-item
        v-for="item in grids"
        :key="item.id"
        :icon="item.src"
        :text="item.title"
        :to="item.to"
      />
    </van-grid>
  </div>
</template>
<script>
import { getlunbo, getGrids } from "@/api";
import Swiper from "@/components/Swiper";
export default {
  components: { Swiper },
  data() {
    return {
      lunbolist: [],
      grids: [],
    };
  },
  created() {
    // getlunbo().then((res) => {
    //   console.log(res);
    // });
    this.getlunbo();
    this.getGrids();
  },
  methods: {
    async getlunbo() {
      // console.log(1);
      const res = await getlunbo();
      this.lunbolist = res.data.message;
    },
    async getGrids() {
      // console.log(1);
      const res = await getGrids();
      console.log(res);
      this.grids = res.data.message;
    },
  },
};
</script>
<style lang="scss" scoped>
</style>